/*
 * Config.h
 *
 *  Created on: 23/ott/2013
 *      Author: angelo
 */

#ifndef CONFIG_H_
#define CONFIG_H_

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <list>
#include <math.h>

#define MAX_PARALLEL_THREADS		128

#define N_ALGO		3

#define SCR			0
#define SCD			1
#define SCD_EX		2
#define ALL_ALGO	N_ALGO

class Config {
public:

	static const char* ALGO_NAME[N_ALGO];

	enum LOG_LEVELS {
		LOG_LOW = 0,
		LOG_MEDIUM = 1,
		LOG_HIGH = 2
	};
public:
	Config(double radius, double radiusNet, int budget, int x, int y, int nc, int nr, LOG_LEVELS log, bool disk, int algoUse,
			bool rand, bool parallel, int nT, double lP, int minCG, int maxCG, double minVarG, double maxVarG):
		radius(radius), radiusNet(radiusNet), budget(budget), xMax(x), yMax(y), nChannels(nc), nRadios(nr), logLevel(log), useDiskAlgorithm(disk), algoToUse(algoUse),
		randomArea(rand), parallelComputation(parallel), nThread(nT), lambdaPoisson(lP), minNumberCenterGravity(minCG), maxNumberCenterGravity(maxCG),
		minVarianceGaussian(minVarG), maxVarianceGaussian(maxVarG){};

	virtual ~Config();

	/**@brief Import a configuration from file */
	static Config *readConfigFromFile(char *fileName);
	static Config *readConfigFromGoodFile(char *fileName);

public:
	double radius;						// raggio di comunicazione per fare covering
	double radiusNet;					// raggio di comunicazione per connettere la rete
	int budget;							// numero di stem-node
	int xMax;							// x massima dell'area da coprire
	int yMax;							// y massima dell'area da coprire
	int nChannels;						// numero di canali possibili
	int nRadios;						// numero di radio disponibili su ogni stem-node
	LOG_LEVELS logLevel;				// livello di log (0_basso, 1, 2_alto)
	bool useDiskAlgorithm;				// true to use disk algorithm, false to use rectangular algorithm
	int algoToUse;						// algorithm to use (0=SCR, 1=SCD, 2=SCD_EX)
	bool randomArea;					// true if the area must be randomly generated; false from a file
	bool parallelComputation;			// true if do it in parallel; false sequential
	int nThread;						// number of parallel thread to lunch if parallel computation
	double lambdaPoisson;				// lambda-poisson per la generazione random dei nodi survivors
	double minNumberCenterGravity;		// minimum number of centers of gravity for the node distribution in the space
	double maxNumberCenterGravity;		// maximum number of centers of gravity for the node distribution in the space
	double minVarianceGaussian;			// minimum Gaussian variance in the centers of gravity
	double maxVarianceGaussian;			// maximum Gaussian variance in the centers of gravity
};

#endif /* CONFIG_H_ */
